#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "entity.h"


void* allocData(void *data)
{
	return (void *)calloc(sizeof(struct Data), 1);
}

int dataCmp(void *data1, void *data2)
{
	struct Data *tmp1 = (struct Data*)data1;
	struct Data *tmp2 = (struct Data*)data2;

	if(tmp1->num>tmp2->num)
		return 1;
	else if(tmp1->num<tmp2->num)
		return -1;
	else 
		return 0;
}

void freeData(void *data)
{
	free(data);
}

void copyData(void *_dst, void *_src)
{
	memcpy(_dst, _src, sizeof(struct Data));
}


void printData(void *data)
{
	struct Data *tmp = (struct Data*)data;
	printf("Num:%d Name:%s ", tmp->num, tmp->name);
}


